package com.lucy.flow.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lucy.common.core.BaseEntity;
import com.lucy.flow.converter.FlowParamConverter;
import com.lucy.flow.converter.StrategyParamConverter;
import com.lucy.flow.domain.dto.FlowParam;
import com.lucy.flow.domain.dto.StrategyParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;

/**
 * @author kindear
 * 流程任务
 */
@Deprecated
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "flow_task")
@ApiModel(value = "流程任务",description = "")
public class FlowTask extends BaseEntity {


    @ApiModelProperty("任务策略")
    @Column(name = "strategy")
    String strategy;


    @Convert(converter = StrategyParamConverter.class)
    @ApiModelProperty("策略参数")
    @Column(name = "strategy_param",length = 1024)
    StrategyParam strategyParam;


    /**
     * 流程实例ID
     */
    @ApiModelProperty("流程实例ID")
    @Column(name = "flow_work_id")
    String flowWorkId;

    /**
     * 流程节点ID
     */
    @ApiModelProperty("流程节点ID")
    @Column(name = "flow_node_id")
    String flowNodeId;

    /**
     * 流程参数， 全流程可访问
     */
    @Convert(converter = FlowParamConverter.class)
    @ApiModelProperty(value = "流程参数",name = "")
    @Column(name = "flow_param",length = 5096)
    FlowParam flowParam;

    /**
     * 任务名称
     */
    @ApiModelProperty("任务名称")
    @Column(name = "task_name")
    String taskName;

    /**
     * 任务状态
     */
    @ApiModelProperty(value = "任务状态",name = "新建CREATED->已完成FINISHED->过期EXPIRED->取消CANCEL->驳回REJECT")
    @Column(name = "task_status")
    String taskStatus;

    /**
     * 完成时间
     */
    @ApiModelProperty("完成时间")
    @Column(name = "finish_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    Date finishTime;

    /**
     * 任务状态
     */
    @ApiModelProperty(value = "任务状态",name = "0被关闭1正常")
    @Column(name = "status")
    Integer status;

}
